home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
T-COMAL Today
/
(k)te.d64
/
quicksort.proc
< prev
next >
Wrap
Text File
|
2009-01-03
|
479b
|
19 lines
9430 PROC QUICKSORT(LEND,REND)
9435 LP:=LEND; RP:=REND
9440 COMP$:=NAME$((LP+RP) DIV 2)
9445 REPEAT
9450 WHILE NAME$(LP)<COMP$ DO
9455 LP:+1
9460 ENDWHILE
9465 WHILE NAME$(RP)>COMP$ DO
9470 RP:-1
9475 ENDWHILE
9480 IF LP<=RP THEN
9485 EXCHANGE(NAME$(LP),NAME$(RP))
9490 LP:+1; RP:-1
9495 ENDIF
9500 UNTIL LP>RP
9505 IF LEND<RP THEN QUICKSORT(LEND,RP)
9510 IF LP<REND THEN QUICKSORT(LP,REND)
9515 ENDPROC QUICKSORT